// string转成object对象
// /?username=zhangsan&pwd=123
// let str = "/?username=zhangsan&pwd=123";
function s2o (str) {
  // console.log("??", str);
  let arr = str.split("?");
  let qs = arr[1];
  // console.log(qs);
  let newarr = qs.split("&");
  // console.log(newarr);
  let obj = {}
  newarr.forEach(item => {
    let line = item.split("=");
    // console.log(line);
    obj[line[0]] = line[1];
  })
  // console.log(obj);
  return obj;
}
// s2o(str);
module.exports = s2o;